/**
 * A Test database class
 */
package docoffice.test;
import java.sql.ResultSet;

import docoffice.database.DatabaseManager;


/**
 * @author Ray Nosari
 * @version $Revision 1.0
 */
public class MySQLTestJDBC2 {
	
	/**
	 * Method main.
	 * @param args String[]
	 */
	public static void main(String args[]){
		final DatabaseManager db = new DatabaseManager();
		ResultSet rs = null;
		try{
			rs = db.runReadQuery("SELECT idtest FROM test");
			System.out.println("Database Manager has sucessfully queried the db");
			boolean hasNext = rs.next();
			boolean isResultAfterLast = rs.isAfterLast();
			while (!isResultAfterLast && hasNext){
				int result = rs.getInt("idtest");
				System.out.println(result);
				hasNext = rs.next();
				isResultAfterLast = rs.isAfterLast();
			}
		} catch(Exception e){
			e.printStackTrace();
		} finally{
			db.closeConnection(rs);
		}
	}
	
	/**
	 * overridden toString method
	 * @return string
	 */
	public String toString(){
		return "This is a class made for testing purposes only.";
	}
}
